diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2026-02-18 15:05:34 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2026-02-18 15:05:34 +0700 |
| commit | 9118c586d2c4fdab43c11409db91cf7b51839261 (patch) | |
| tree | f2c2c9415e613c153a51f8ed2760933f4ebd8bc9 /src/pages/shop/category/[slug].jsx | |
| parent | 8c4d73ff159cb7b5df4f83f1eb76e8a06c7179ce (diff) | |
| parent | 7ef19bc5b5dc64fc0fb8126cec02943f06a4237a (diff) | |
Merge branch 'new-release' of https://bitbucket.org/altafixco/next-indoteknik into cr_renca_keyword
Diffstat (limited to 'src/pages/shop/category/[slug].jsx')
| -rw-r--r-- | src/pages/shop/category/[slug].jsx | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/pages/shop/category/[slug].jsx b/src/pages/shop/category/[slug].jsx index 11840d47..e515e3f4 100644 --- a/src/pages/shop/category/[slug].jsx +++ b/src/pages/shop/category/[slug].jsx @@ -16,13 +16,14 @@ const ProductSearch = dynamic(() => ); const CategorySection = dynamic(() => import('@/lib/product/components/CategorySection') -) +); export default function CategoryDetail() { const router = useRouter(); const { slug = '', page = 1 } = router.query; - const [dataCategories, setDataCategories] = useState([]) + const [dataCategories, setDataCategories] = useState([]); + const [shortDesc, setShortDesc] = useState(''); const categoryName = getNameFromSlug(slug); const categoryId = getIdFromSlug(slug); const q = router?.query.q || null; @@ -33,6 +34,22 @@ export default function CategoryDetail() { if (q) { query.q = q; } + useEffect(() => { + if (!router.isReady) return; + if (!categoryId) return; + + const loadShortDesc = async () => { + const res = await odooApi( + 'GET', + `/api/v1/category/${categoryId}/short-desc` + ); + + const desc = res?.shortDesc || ''; + setShortDesc(desc); + }; + + loadShortDesc(); + }, [router.isReady, categoryId]); return ( <BasicLayout> @@ -47,11 +64,14 @@ export default function CategoryDetail() { ]} /> - <Breadcrumb categoryId={categoryId} /> - + <Breadcrumb categoryId={categoryId} shortDesc={shortDesc} /> {!_.isEmpty(router.query) && ( - <ProductSearch query={query} categories ={categoryId} prefixUrl={`/shop/category/${slug}`} /> + <ProductSearch + query={query} + categories={categoryId} + prefixUrl={`/shop/category/${slug}`} + /> )} </BasicLayout> ); |
